<template>
	<view class="contetn">
		<view class="body_head" click="backurl">
			<text class="icon-fanhui iconfont"></text> 审核结果
		</view>

		<view class="user_info">
				{{info.name}} <text>预审额度{{info.money}} </text>
		</view>


		<veiw class="showwind" v-if="0==show">

			<view class="showwind1">
				<image src="/static/dd.png" mode=""></image>
			</view>

			<view class="showwind2"> 等待审核 </view>


			<view class="showwind4"> 正在审核中，请耐心等待！ </view>
		</veiw>

		<veiw class="showwind" v-if="1==show">
			<view class="showwind1">
				<image src="/static/wtg.png" mode=""></image>
			</view>
			<view class="showwind2"> 审核拒绝 </view>
			<view class="showwind3"> 拒绝原因：虚假信息 </view>
			<view class="showwind3"> {{info.desc}} </view>
			<view class="showwind4"> 很遗憾，经评估你暂时未通过审核，可过段时间再来申请！ </view>
		</veiw>

		<veiw class="showwind" v-if="2==show">
			<view class="showwind1">
				<image src="/static/wc.png" mode=""></image>
			</view>
			<view class="showwind2"> 审核通过 </view>

			<view class="showwind4"> 恭喜您，审核成功！ </view>
		</veiw>


		<view class="close"> 我知道了 </view>

	</view>
</template>

<script>

	import { curl } from 'common/api.js';
	export default {
		data() {
			return {
				show:1,
				info:[],
				pollingTimer: null // 添加轮询定时器
			}
		},
		onLoad(ret) {

			if(!ret.id){
				uni.navigateTo({
					url:"/pages/index/index"
				})
			}

			this.id=ret.id;



			this.getinfobyid();
		},
		methods: {
			getinfobyid(){

				var that = this;
				var id=this.id;

				curl('daikuan/getinfobyid', {
					id: id,
				}).then((res) => {
					console.log(res)
					// 如果状态为0，则每3秒轮询一次
					if(res.data.status == 0) {
						that.show = res.data.status;
						that.info = res.data;
						// 设置3秒后再次查询
						that.pollingTimer = setTimeout(() => {
							that.getinfobyid();
						}, 3000);
					} else {
						// 状态不为0时，更新界面并清除定时器
						that.show = res.data.status;
						that.info = res.data;
						if(that.pollingTimer) {
							clearTimeout(that.pollingTimer);
							that.pollingTimer = null;
						}
					}
				})

			}
		},
		// 页面卸载时清除定时器
		onUnload() {
			if(this.pollingTimer) {
				clearTimeout(this.pollingTimer);
				this.pollingTimer = null;
			}
		}
	}
</script>

<style>


	.close{
		background: #ff8e69;
		color: #ffffff;
		width: 200rpx;
		height: 80rpx;
		margin: 120rpx auto;
		line-height: 80rpx;text-align: center;
		border-radius: 80rpx;
		font-weight: bold;
		font-size: 32rpx;
	}
	.showwind4{
		width: 700rpx;
		height: 100rpx;
		margin: auto;
		text-align: center;
		line-height: 120rpx;
		font-size: 24rpx;
		color: #555;font-weight: 400;
	}
	.showwind3{
		width: 700rpx;
		height: 50rpx;
		margin: auto;
		text-align: center;
		line-height: 50rpx;
		font-size: 28rpx;
		color: #333;font-weight: 400;

	}
	.showwind2{
		height: 120rpx;
		width: 700rpx;
		margin: auto;
		text-align: center;
		line-height: 120rpx;
		font-size: 34rpx;
		color: orangered;
		font-weight: bold;
	}

	.showwind1>image{
		width: 120rpx;
		height:120rpx;
		margin: 40rpx auto;

	}
	.showwind1{
		width: 200rpx;
		height:200rpx;
		margin: auto;
		text-align: center;
		background: #feb02d;
		border: 1px solid transparent;
		border-radius: 200rpx;
	}
	.showwind{
		width: 700rpx;
		margin: 80rpx auto;
	}
	.user_info>text{
		margin-left: 20rpx;
	}
	.user_info{
		width: 100%;
		height: 200rpx;
		text-align: center;
		line-height: 200rpx;
		font-size: 32rpx;
		color: #333;
		font-weight: 500;
	}
	.body_head>text {
		color: #ffffff;
		font-weight: bold;
		font-size: 30rpx;
		margin-right: 10rpx;
	}

	.body_head {
		width: 750rpx;
		height: 90rpx;
		line-height: 90rpx;
		margin: auto;
		display: flex;
		align-items: center;
		font-size: 30rpx;
		background: #ff8f67;
		color: #ffffff;
		text-indent: 25rpx;
	}

	.contetn{
		width: 100%;
		min-height: 100vh;
		background: #fef7ff;
	}

</style>
